﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using Views.Infrastructure;

namespace Views
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            /*
             * When a ViewResult is being processed, the action invoker obtains the set of installed view
                engines and calls their FindView methods in turn.
                The action invoker stops calling FindView methods as soon as it receives a ViewEngineResult object
                that contains an IView. This means that the order in which engines are added to the ViewEngines.Engines
                collection is significant if two or more engines are able to service a request for the same view name.
             * */
            ViewEngines.Engines.Add(new DebugDataViewEngine());

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
    }
}